package com.sinoglobal.dumping.dumplingspring;

import com.sinoglobal.dumping.fragment.Dumpling_HomeFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by KeZhuang on 2016/1/26.
 */
public class DumplingObservable {
    private List<DumplingObserver> list = new ArrayList<DumplingObserver>();
    public void addElement(DumplingObserver observable){
        list.add(observable);
    }
    public void removeElement(DumplingObserver observable){
        list.remove(observable);
    }
    public void clearElement(){
        list.clear();
    }
    public void notifyChange(Dumpling_HomeFragment fragment, boolean isChangeUI, boolean isVote){
        for(DumplingObserver observer : list){
            observer.update(fragment,isChangeUI,isVote);
        }
    }
    public int size(){
        return list.size();
    }
}
